package com.skymobi.freesky;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLDecoder;

import com.edroid.common.base64.Base64;
import com.skymobi.freesky.plug.old.cmmn.CmmnDecode;

public class FreeSkyReader {

	public static void main(String[] args) {
		InputStream is = null;
		
		try {
			is = FreeSkyReader.class.getResourceAsStream("/assets/assets.txt");
			BufferedReader reader = new BufferedReader(new InputStreamReader(is));
			StringBuilder sb = new StringBuilder(1024);
			String line = null;
			while((line = reader.readLine()) != null) {
				sb.append(line);
			}

			String src = sb.toString(); 
			
			System.out.println("src:\n");
			System.out.println(src);
			System.out.println();
			
			String dec0 = Base64.decode(src);
			System.out.println("dec0:\n");
			System.out.println(dec0);
			System.out.println();
			
			String dec1 = CmmnDecode.decrypt(dec0, 8389, 84322);
			
			String dec2 = URLDecoder.decode(dec1, "UTF-8");

			System.out.println("dec1:\n");
			System.out.println(dec1);
			System.out.println();
			
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
